//
//  TabBarController.swift
//  KCB
//
//  Created by leeqb on 11/1/15.
//  Copyright © 2015 powerlee. All rights reserved.
//

class TabBarController: UITabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        let main = LBI("Main") as! UINavigationController
        let family = LBI("Family") as! UINavigationController
        let heart = LBI("Heart") as! UINavigationController
        let task = LBI("Task") as! UINavigationController
        let me = LBI("Me") as! UINavigationController
        
        self.viewControllers = [main, family, heart, task, me]
        
        //self.tabBar.tintColor = UIColor.lightGrayColor()
        
        var tb = self.tabBar.items![0]
        //tb.title = "我的家人"
        tb.image = UIImage(named: "tb_main_gray")?.imageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal)
        tb.selectedImage = UIImage(named: "tb_main_red")?.imageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal)
        tb.imageInsets = UIEdgeInsetsMake(7, 0, -7, 0)
        
        tb = self.tabBar.items![1]
        //tb.title = "我的家庭"
        tb.image = UIImage(named: "tb_family_gray")?.imageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal)
        tb.selectedImage = UIImage(named: "tb_family_red")?.imageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal)
        tb.imageInsets = UIEdgeInsetsMake(7, 0, -7, 0)
        
        tb = self.tabBar.items![2]
        //tb.title = ""
        tb.image = UIImage(named: "tb_heart")?.imageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal)
        tb.selectedImage = UIImage(named: "tb_heart")?.imageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal)
        tb.imageInsets = UIEdgeInsetsMake(6, 0, -6, 0)
        
        tb = self.tabBar.items![3]
        //tb.title = "我的任务"
        tb.image = UIImage(named: "tb_task_gray")?.imageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal)
        tb.selectedImage = UIImage(named: "tb_task_red")?.imageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal)
        tb.imageInsets = UIEdgeInsetsMake(7, 0, -7, 0)
        
        tb = self.tabBar.items![4]
        //tb.title = "我的..."
        tb.image = UIImage(named: "tb_me_gray")?.imageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal)
        tb.selectedImage = UIImage(named: "tb_me_red")?.imageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal)
        tb.imageInsets = UIEdgeInsetsMake(7, 0, -7, 0)
    }

}
